# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  helper :all # include all helpers, all the time
  protect_from_forgery # See ActionController::RequestForgeryProtection for details
  before_filter :authorize, :except => [:index, :login, :register, :register_admin]
   # ... 
   def authorize 
    unless Admin.find_by_username(session[:user_name]) 
     flash[:notice] = session[:user_name] 
     redirect_to :controller =>"store",:action=>"index" 
    end 
   end  
  # Scrub sensitive parameters from your log
  # filter_parameter_logging :password
end
